﻿<Window x:Class="Fidely.Demo.GettingStarted.WPF.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:fidely="clr-namespace:Fidely.Framework.Integration.WPF;assembly=Fidely.Framework.Integration.WPF"
        Title="Fidely Demo Application"
        WindowStartupLocation="CenterScreen"
        MinHeight="500" Height="500" MinWidth="800" Width="800">
    <DockPanel>
        <DockPanel DockPanel.Dock="Top">
            <DockPanel.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Color="#FAFAFA" Offset="0.35"/>
                    <GradientStop Color="#E0E0E0" Offset="0.95"/>
                    <GradientStop Color="#EEEEEE" Offset="1"/>
                </LinearGradientBrush>
            </DockPanel.Background>
            <Menu DockPanel.Dock="Left" Background="Transparent" VerticalAlignment="Center">
                <MenuItem Header="File" Padding="15,5">
                    <MenuItem Header="Close" Command="{Binding CloseCommand}"/>
                </MenuItem>
                <MenuItem Header="Tools" Padding="15,5">
                    <MenuItem Header="Log Viewer" Command="{Binding LogCommand}"/>
                    <MenuItem Header="Preferences" Command="{Binding PreferencesCommand}"/>
                </MenuItem>
                <MenuItem Header="Help" Padding="15,5">
                    <MenuItem Header="About" Command="{Binding AboutCommand}"/>
                </MenuItem>
            </Menu>
            <Label Margin="60,0,0,0" VerticalAlignment="Center">Search :</Label>
            <Border Margin="3" Background="White" CornerRadius="5" BorderThickness="1" BorderBrush="LightGray" HorizontalAlignment="Stretch" VerticalAlignment="Center">
                <fidely:AutoCompleteBox SearchCommand="{Binding SearchCommand}" AutoCompleteItems="{Binding AutoCompleteItems}"  MatchingMode="{Binding Preferences.MatchingMode}">
                    <fidely:AutoCompleteBox.Resources>
                        <Style TargetType="TextBox">
                            <Setter Property="BorderBrush" Value="Transparent"/>
                            <Setter Property="Margin" Value="1"/>
                        </Style>
                    </fidely:AutoCompleteBox.Resources>
                </fidely:AutoCompleteBox>
            </Border>
        </DockPanel>
        <DataGrid ItemsSource="{Binding SearchResult}" AutoGenerateColumns="False" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray">
            <DataGrid.Resources>
                <Style x:Key="ElementStyle" TargetType="TextBlock">
                    <Setter Property="Margin" Value="3"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                </Style>
                <Style x:Key="EditingElementStyle" TargetType="TextBox">
                    <Setter Property="Padding" Value="1"/>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Product ID" Binding="{Binding ProductID}" Width="130" ElementStyle="{StaticResource ElementStyle}" EditingElementStyle="{StaticResource EditingElementStyle}"/>
                <DataGridTextColumn Header="Product Name" Binding="{Binding Name}" Width="230" ElementStyle="{StaticResource ElementStyle}" EditingElementStyle="{StaticResource EditingElementStyle}"/>
                <DataGridTextColumn Header="List Price" Binding="{Binding ListPrice}" Width="180" ElementStyle="{StaticResource ElementStyle}" EditingElementStyle="{StaticResource EditingElementStyle}"/>
                <DataGridTextColumn Header="Sell Start Date" Binding="{Binding SellStartDate, StringFormat={}{0:yyyy/MM/dd}}" Width="150" ElementStyle="{StaticResource ElementStyle}" EditingElementStyle="{StaticResource EditingElementStyle}"/>
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Window>
